package com.ykq.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @program: qy145-key
 * @description:
 * @author: 闫克起2
 * @create: 2021-12-17 08:36
 **/
public class LoginInterceptor  implements HandlerInterceptor {

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Object staff = request.getSession().getAttribute("staff");
        if(staff!=null){
             return true;
        }

        response.sendRedirect("/login.jsp");
        return false;

    }
}
